<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta content="This is Chris's Home Page" name="description">
    <meta content="Chris,Web,Music,photo" name="keywords">
    <meta content="text/html;charset=utf-8" http-equiv="content-type"/>
    <title>Hello JavaScript!</title>
    <script type="text/javascript">
        function onLogin() {
            var form = document.form01;
            var userName = form.username;
            if (userName.value == "") {
                alert("User Name is blank！");
            } else {
                window.location.href = "https://www.baidu.com/"
            }

        }

        function onReset() {
            var form = document.form01;
            var stu = {name: "zhangsan", age: 18, sex: true};

            console.dir(stu);
            form.reset();
        }

        //
        function onTest() {
            var form = document.form01;
            for (var i in form.elements) {
                form.elements[i].value = "ABC";
            }
            form.firstname.select();
        }

        function onKeyup() {
            var form = document.form01;
            form.lastname.value = form.firstname.value.length;
        }
    </script>
</head>
<body>
<br/>
<form action="" name="form01">
    User Name:<input name="username" type="text">
    <br/> <br/>
    Password:<input name="password" type="password">
    <br/> <br/>
</form>
<button onclick="onLogin()">Login</button>
<button onclick="onReset()">Reset</button>
<br/>

</body>
</html>
